import json

from flask import Blueprint
from flask import request
from flask import Response

from app.comm.db import db
from app.comm.db import jsonformater
from app.comm.pub import RestEntity
from app.comm.pub import class2dict

configservice = Blueprint('config', __name__,)

@configservice.route("/rest/system/config/list",methods=['POST','GET'])
def configList():  
    #dict1 = json.loads(a)
    tables=db.session.execute("select config_id configId,config_name configName,config_key configKey,config_value configValue,create_time createTime,remark from sys_config").fetchall()
    datas= [dict(r) for r in tables] 
    result=RestEntity(0,0,datas,"登陆成功！")
    return json.dumps(class2dict(result), default=jsonformater)
 
    #return json.dumps(dict1)         